home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / fix43.zip / FIX43.ASM < prev    next >
Assembly Source File  |  1988-05-26  |  3KB  |  126 lines

  1.  title FIX43 -- fix 43 line mode cursor
  2.  
  3. comment #
  4.  
  5. The cursor in 43 line is fleeting, at best.  This resident program fixes
  6. that by checking for 8x8 characters every timer interrupt, and if the
  7. EGA is in 8x8 mode, the cursor start and end lines are set to their
  8. proper values.
  9.  
  10. #
  11.  
  12.  
  13. ;
  14. ; Interrupt vector segment definitions.
  15. ;
  16.  
  17. ints segment at 0
  18.  org 8*4                ;Point to Int 9 (timer) vector.
  19. int8 label word
  20.  org 460h
  21. cursor label word       ;Cursor scan lines.
  22.  org 485h
  23. points label byte       ;Number of scan lines/char.
  24. ints ends
  25.  
  26.  
  27. ;
  28. ; Program segment.
  29. ;
  30.  
  31. fix43 segment
  32.  assume CS:fix43,DS:fix43,ES:fix43,SS:fix43
  33.  
  34. ;
  35. ; Put service code as low as DOS will allow.
  36.  org 5Ch
  37. old8 dw ?,?
  38. trap label word         ;Location for interrupt traps.
  39.  
  40. ;
  41. ; Start of .COM code - jump to installation.
  42.  org 100h
  43. start:
  44.   jmp copy              ;Go set up traps.
  45.  
  46.   db 13,'FIX43 version 1.0  Copyright (C) 1988  Mark Adler',13,10
  47.   db 'All rights reserved.',13,10,'Z'-64
  48.  
  49. ;
  50. ; Traps - only assume CS points here.
  51.   assume DS:nothing,ES:nothing,SS:nothing
  52. set:                    ;Traps.
  53.  
  54.   db 'FIX43TSR'         ;Identifier to find enable flag.
  55.  enbl db 1              ;Enable flag for this fix.
  56.  
  57.  cfix:
  58.   ;
  59.    test byte ptr trap+(enbl-set),1      ;See if enabled.
  60.    jz nofix             ;If not, skip all this.
  61.     push DS
  62.     push AX
  63.     sub AX,AX           ;Point DS to BIOS data area.
  64.     mov DS,AX
  65.     assume DS:ints
  66.     mov AL,points       ;Get number of scan lines/character.
  67.     cmp AL,8            ;See if 8 instead of 14.
  68.     jne not43           ;If not, go on to timer service.
  69.      push DX
  70.      mov DX,03D4h       ;Point to CRTC ports.
  71.      mov AX,060Ah       ;Set cursor start scan line to 7.
  72.      cmp cursor,0707h   ;See if line cursor desired.
  73.      je lincur          ;If so, cursor is a line.
  74.      cmp cursor,0607h   ;This is also a line cursor.
  75.      je lincur
  76.       mov AH,2          ;Else cursor is a block.
  77.     lincur:
  78.      out DX,AX
  79.      mov AX,000Bh       ;Set cursor end scan line to 0.
  80.      out DX,AX
  81.      pop DX
  82.    not43:
  83.     pop AX
  84.     pop DS
  85.     assume DS:nothing
  86.   nofix:
  87.    jmp dword ptr old8   ;Go on to original routine.
  88.  
  89.  setlen equ $-set       ;End of traps.
  90.  
  91.  
  92. ;
  93. ; Installation code - all segment registers set.
  94.  assume DS:fix43,ES:fix43,SS:fix43
  95.  
  96.  copy:
  97.   ;
  98.   ; Install traps and tell DOS to leave them in memory.
  99.   ;
  100.         ; copy traps to lower memory.
  101.    cld
  102.    mov SI,offset set
  103.    mov DI,offset trap
  104.    mov CX,(setlen+1)/2
  105.    rep movsw
  106.         ; insert trap in timer tick interrupt vector.
  107.    sub AX,AX
  108.    mov ES,AX            ;Point to interrupt area.
  109.    assume ES:ints
  110.    cli                  ;Disable interrupts during change.
  111.    mov AX,int8          ;Save old pointer.
  112.    mov old8,AX
  113.    mov AX,int8+2
  114.    mov old8+2,AX
  115.    mov int8,offset trap+(cfix-set)      ;Change Int 8 to the trap.
  116.    mov int8+2,CS
  117.    sti                  ;Interrupts OK now.
  118.         ; tell DOS to keep the traps in memory and exit.
  119.    mov DX,offset trap+setlen    ;Amount to keep.
  120.    int 27h              ;Exit and remain resident.
  121.  
  122.  
  123. fix43 ends
  124.  
  125. end start
  126.